<include file="public@header" />
</head>
<style>
    td input,td select{ width:auto; max-width:180px;}
</style>
<body>
<div class="wrap js-check-wrap">
    <form  class="form-horizontal js-ajax-form" method="post" action="{:url('Orders/index')}">

        <div class="row" style="text-align:center">
            <div class="col-md-6">
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr ><td colspan="8" style="text-align:center; font-size: 20px; color:#000;font-weight: bold ">销售结算单</td></tr>
                    <tr ><td  >单位名称：</td><td colspan="7">济南恭德陵园</td></tr>
                    <tr ><td >地 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：  </td><td >济南市柳埠镇柳东村  </td>
                        <td colspan="3" style="text-align:center;;">电  话：  0531-82841666   </td>
                        <td >传 真： </td><td > </td>
                    </tr>
                    <tr >
                        <td >网 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</td>
                        <td colspan="7">www.sdgdly.com</td>
                    </tr>
                    <tr  style="border-top:3px solid #0a0909;">
                        <td >客户姓名：</td>
                        <td >{$result.buyer_name}</td>
                        <td >证件类型：</td>
                        <td colspan="2">{:cart_type('cart',$result.cart_type)}</td>
                        <td >证件号码：</td>
                        <td  colspan="2"> {$result.customer_account}</td>
                    </tr>
                    <tr>
                        <td >联系地址：</td>
                        <td colspan="7"> </td>
                    </tr>
                    <tr >
                        <td >合同编号：</td>
                        <td > {$result.contract_sn}</td>
                        <td >墓位编号：</td>
                        <td colspan="2">{$result.tomb_num}</td>
                        <td >具体位置：</td>
                        <td colspan="3">{$result.tomb_region} </td>
                    </tr>
                    <tr >
                        <td >墓穴规制：</td>
                        <td >{$result.tomb_regulation_name} </td>
                        <td >墓穴状态：</td>
                        <td colspan="2">{$result.col_status_name} </td>
                        <td >操 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作：</td>
                        <td  colspan="2">购买 </td>
                    </tr>
                    <tr style="border-top:3px solid #0a0909;" >
                        <td colspan="8"> 服务费用（售后服务的收费项目）</td>
                    </tr>
                    <tr style="border-top:3px solid #0a0909;">
                        <th>序号</th>
                        <th>项目名称</th>
                        <th>数量</th>
                        <th>单位</th>
                        <th>单价（元）</th>
                        <th>优惠</th>
                        <th>金额</th>
                        <th>备注</th>
                    </tr>
                    </thead>
                    <tbody>
                    <foreach name="project_list" item="vo">
                        <tr >
                            <td>{$key+1} </td>
                            <td>{$vo.project_name} </td>
                            <td>{$vo.project_unit} </td>
                            <td>{$vo.num} </td>
                            <td><if condition="$vo.type eq 1">
                                <input type="hidden" class="unit_price"  name="project[{$key}][unit_price]" value="{$vo.unit_price}"/>
                                <input type="hidden" class="num"  name="project[{$key}][num]"  value="{$vo.num}"/>
                                <input type="hidden" class="deal_price" name="project[{$key}][deal_price]"  value="{$vo.unit_price*$vo.num}"/>
                                {$vo.unit_price}
                                <else />
                                <input type="hidden" class="num"  name="project[{$key}][num]"  value="{$vo.num}"/>
                                <input type="hidden" class="deal_price" name="project[{$key}][deal_price]"  value="{$vo.unit_price}"/>
                                <input type="hidden" class="unit_price" name="project[{$key}][unit_price]" value="{$vo.unit_price}"/> {$vo.unit_price}
                            </if></td>
                            <td> <if condition="$vo.type eq 1">
                                {$vo.discount_rate}%
                                <input type="hidden"  name="project[{$key}][discount_rate]" value="{$vo.discount_rate}" />
                                <else />
                                <input type="hidden"  name="project[{$key}][discount_rate]" value="{$vo.discount_rate}" />
                            </if> </td>
                            <td> <input type="hidden" class="total_price"  name="project[{$key}][total_price]" value="{$vo.total_price}"/>
                                {$vo.total_price} </td>
                            <td> </td>
                        </tr>
                    </foreach>
                    <tr style="border-bottom: 0px ">
                        <td colspan="6" style="font-weight: bold">合计：</td>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td colspan="8" style="text-align:left;padding-left: 30px;font-size: 15px;font-weight: bold ;border-top: 1px  solid #0a0909;border-bottom: 1px  solid #0a0909">   质量保证</td>
                    </tr>
                    <tr><td colspan="8" style="text-align:left;">1.客户验收购买的墓穴墓碑，质保期为 _<if condition=" $result.warranty eq 1">5 <else/>20</if>___年。</td></tr>
                    <tr><td colspan="8" style="text-align:left;">2.质保期内凡产品质量问题包换包修，质保期从《墓穴安葬证》交付客户日之起计算。</td></tr>
                    <tr><td colspan="8" style="text-align:left;">3.墓穴管理维护期20年为一期，以首位逝者使用之日起计算。</td></tr>
                    <tr><td colspan="8" style="text-align:left;">4.质保范围以墓碑原件为准，客户单独购买的附件不在质保范围之中。</td></tr>
                    <tr><td colspan="8" style="text-align:left;">5.维保更换墓碑新构件/新产品执行    年质保期，原墓碑构件维修后不再执行质保。</td></tr>
                    <tr><td colspan="8" style="text-align:left;">6.客户全款购墓不包含刻字、贴金、瓷像、落葬等费用与服务，请凭《墓穴安葬证》办理以上相关售后业务。</td></tr>
                    <tr>
                        <td  colspan="2">经办人：{$result.handle_name}</td>
                        <td  colspan="2">收款人：{:cmf_get_admin_name()} </td>
                        <td  colspan="3">客户签字： </td>
                        <td  >日期：2017.1.18</td>
                    </tr>
                    </tbody>
                </table>
                <div class="form-actions">
<!--                    <div class="btn btn-primary" id="check-save">保存</div>-->
                    <div class="btn btn-primary toPrint" data-url="{:url('Finance/dy_add_post')}"
                         data-key="1" id="toPrint" data-wm_id="{$result.tomb_id}" data-o_id="{$result.order_id}" data-warranty="<if condition=" $result.warranty eq 1">5 <else/>20</if>">打印结算单</div>
                    <div class="btn btn-primary  "
                         data-url="{:url('Finance/dy_dz_post')}" data-key="1" id="btn-dymz"
                         data-wm_id="{$result.tomb_id}" data-o_id="{$result.order_id}" data-czr_id="{$result.customer_id}">打印墓证</div>
<!--                    <div class="btn btn-primary toPrint" data-url="{:url('toPrintBuried')}" data-key="2" id="toPrintBuried">打印落葬单</div>-->
<!--                    <div class="btn btn-primary toPrint" data-url="{:url('toPrintView')}" data-key="3" id="toPrintView"  >打印预览</div>-->
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript">
    //切换显示
    $(document).on('click','.nav_tabs li',function(){
        $(this).addClass('active').siblings().removeClass('active');
        var index = $(".nav_tabs li").index(this);
        billtype = index;
        console.log(index);
        $('.content_nav').eq(index).removeClass("feature").siblings().addClass("feature");
    });

    $('#toPrint').click(function () {
        var wm_id = $(this).data('wm_id'),
            o_id = $(this).data('o_id'),
        warranty = $(this).data('warranty');

        layer.confirm("确定要打印结算单吗？", {
            icon:3,
            title: "提示", btn: ['确定', '暂不']
            , btn1: function () {
                $.ajax({
                    type: "POST",
                    url: "{:url('Finance/dy_add_post')}",
                    data: { mwid: wm_id,o_id:o_id,warranty:warranty },
                    dataType: "json",
                    success: function (r) {
                        // if (r.code == 0) { layer.alert("操作失败！", { icon: 5 }); }
                        // else {
                        //     layer.msg("取消成功！", { icon: 1,time:1000 }, function () {
                        //         if (r.code == 0) {
                        //             parent.location.reload();
                        //         } else {
                        //             location.reload();
                        //         }
                        //
                        //     });
                        // }
                    }
                });
            }
            , btn2: function () {
                layer.closeAll();
            }
        });
    })

    $("#btn-dymz").on('click', function () {
        var wm_id = $(this).data('wm_id'),
            url = $(this).data('url'),
            o_id = $(this).data('o_id'),
            czrid = $(this).data('czr_id'),
            warranty =0;
        $.ajax({
            type: "POST",
            url: "{:url('Finance/dy_dz_post')}",
            data: { mwid: wm_id,oid:o_id,czrid:czrid },
            dataType: "json",
            success: function (r) {
                console.log(r)
                //操作成功
                localStorage.setItem("mz", JSON.stringify(r.data));
                window.open('{:url("Print/muzheng")}',false);
            }
        });
    });
</script>


</body>
</html>